package com.springcloud.eshop.datasync.service;

import com.springcloud.eshop.datasync.service.impl.EshopProductCallbackService;
import com.springcloud.eshop.entity.Brand;
import com.springcloud.eshop.entity.Category;
import com.springcloud.eshop.entity.Product;
import com.springcloud.eshop.entity.ProductIntro;
import com.springcloud.eshop.entity.ProductProperty;
import com.springcloud.eshop.entity.ProductSpecification;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Desc:
 * @Date: 2020-07-02
 * @Version:v1.0
 */
@FeignClient(value = "eshop-product-service", fallback = EshopProductCallbackService.class)
public interface EshopProductService {

    @RequestMapping(value = "brand/selectOne", method = RequestMethod.GET)
    Brand selectOneBrand(@RequestParam(value = "id") Long id);

    @RequestMapping(value = "category/selectOne", method = RequestMethod.GET)
    Category selectOneCategory(@RequestParam(value = "id") Long id);

    @RequestMapping(value = "product/selectOne", method = RequestMethod.GET)
    @ResponseBody
    Product selectOneProduct(@RequestParam(value = "id") Long id);

    @RequestMapping(value = "productIntro/selectOneByProductId", method = RequestMethod.GET)
    @ResponseBody
    ProductIntro selectOneProductIntroByProductId(@RequestParam(value = "productId") Long productId);

    @RequestMapping(value = "productProperty/selectOneByProductId", method = RequestMethod.GET)
    @ResponseBody
    ProductProperty selectOneProductPropertyByProductId(@RequestParam(value = "productId") Long productId);

    @RequestMapping(value = "productSpecification/selectOneByProductId")
    @ResponseBody
    ProductSpecification selectOneProductSpecificationByProductId(@RequestParam(value = "productId") Long productId);

    @RequestMapping(value = "product/selectProducts")
    @ResponseBody
    List<Product> selectProducts(@RequestParam("productIds") String productIds);
}
